home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MOUSE_UT / AZZAM10 / TEST.PAS < prev   
Pascal/Delphi Source File  |  1994-10-31  |  3KB  |  88 lines

  1. PROGRAM MouseTest;
  2.  
  3. { *******************************************************************
  4.     this program is a demo of the mouse routines for AzzaMouse v1.0
  5.   ******************************************************************* }
  6.  
  7. USES Mouse, Graph;
  8.  
  9. PROCEDURE SetUp1024x768Mode;
  10. VAR
  11.   Gm, Gd : INTEGER;
  12.  
  13. BEGIN
  14.   Gd := InstallUserDriver( 'SVGA256', NIL );
  15.   Gm := 4;
  16.  
  17.   InitGraph( Gd, Gm, '' );
  18.  
  19.   IF GraphResult <> grOk
  20.     THEN halt;
  21. END;
  22.  
  23. { -------------------------------------------------------------------- }
  24.  
  25. PROCEDURE Close1024x768Mode;
  26. BEGIN
  27.   CloseGraph;
  28. END;
  29.  
  30. VAR
  31.   s1, s2, st : STRING;
  32.  
  33. BEGIN
  34.   WriteLn('AzzaMouse v1.0 - mouse test demo program.');
  35.   WriteLn;
  36.   WriteLn('press [ENTER] to continue.');
  37.   ReadLn;
  38.  
  39.   IF MouseExist
  40.     THEN BEGIN
  41.            SetUp1024x768Mode;
  42.            InitMouseDriver;
  43.  
  44.            SetFillStyle( SolidFill, Black );
  45.            Bar( 0, 0, GetMaxX, GetMaxY );
  46.  
  47.            SetColor( LightRed );
  48.            SetTextStyle( DefaultFONT, HorizDir, 3 );
  49.            OutTextXY( 290, 20, 'MOUSE TEST PROGRAM' );
  50.  
  51.            SetColor( White );
  52.            Rectangle( 0, 0, GetMaxX, GetMaxY );
  53.            Rectangle( ( GetMaxX shr 1 ) - round(( GetMaxX shr 2 ) * 1.5 ) - 1,
  54.                       ( GetMaxY shr 1 ) - round(( GetMaxY shr 2 ) * 1.5 ) - 1,
  55.                       ( GetMaxX shr 1 ) + round(( GetMaxX shr 2 ) * 1.5 ) + 1,
  56.                       ( GetMaxY shr 1 ) + round(( GetMaxY shr 2 ) * 1.5 ) + 1);
  57.  
  58.            SetMinMax( Horz,
  59.                       ( GetMaxX shr 1 ) - round(( GetMaxX shr 2 ) * 1.5 ),
  60.                       ( GetMaxX shr 1 ) + round(( GetMaxX shr 2 ) * 1.5 ));
  61.            SetMinMax( Vert,
  62.                       ( GetMaxY shr 1 ) - round(( GetMaxY shr 2 ) * 1.5 ),
  63.                       ( GetMaxY shr 1 ) + round(( GetMaxY shr 2 ) * 1.5 ));
  64.            ShowMouse;
  65.  
  66.            SetTextStyle( DefaultFONT, HorizDir, 2 );
  67.            SetColor( Yellow );
  68.            REPEAT
  69.              ASM CLI; END;
  70.  
  71.              IF MouseData.Moved
  72.                THEN BEGIN
  73.                       SetFillStyle( SolidFill, Black );
  74.                       Bar( 430, 70, 430 + ( 10 * 16 ), 70 + 16 );
  75.                       Str( MouseData.x:4, s1 );
  76.                       Str( MouseData.y:3, s2 );
  77.                       OutTextXY( 430, 70, '(' + s1 + ',' + s2 + ')' );
  78.                     END;
  79.              MouseData.Moved := FALSE;
  80.  
  81.              ASM STI; END;
  82.            UNTIL MouseData.bmask = 3;
  83.  
  84.            KillMouseDriver;
  85.            Close1024x768Mode;
  86.          END
  87.     ELSE WriteLn( 'ERROR :- mouse driver not installed, cannot continue.');
  88. END.